<?php
/**
 * FastApp.
 * 8/21/24
 * @Author 深色的海 (wx:deepsea_0024)
 * @Contact telegram:deepsea159
 */

namespace App\Marketing\Api\Controller;

use App\Fastapp\Api\Controller\ApiController;
use App\Marketing\Api\Service\LottoService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\GetMapping;
use Hyperf\HttpServer\Annotation\PostMapping;
use Psr\Http\Message\ResponseInterface;

#[Controller('api/marketing/lotto')]
class LottoController extends ApiController
{
    #[Inject]
    public LottoService $service;

    #[GetMapping('detail')]
    public function detail(): ResponseInterface
    {
        return $this->success($this->service->detail($this->request->input('code')));
    }

    #[PostMapping('bet')]
    public function bet(): ResponseInterface
    {
        return $this->success($this->service->bet($this->request->all()));
    }

    #[GetMapping('list')]
    public function list(): ResponseInterface
    {
        return $this->success($this->service->list($this->request->all()));
    }

    #[GetMapping('history')]
    public function history(): ResponseInterface
    {
        return $this->success($this->service->history($this->request->input('code')));
    }
}